package ConCom.test1;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class MapTest extends Mapper<LongWritable, Text, IntWritable, Text> {
    IntWritable k = new IntWritable(1);

    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, IntWritable, Text>.Context context) throws IOException, InterruptedException {
        if (!value.toString().startsWith("SEQ")) {
            int count = 0;
            String[] datas = value.toString().split(",");
            for (String data : datas) {
                if (data.equals("")) {
                    count++;
                }
            }
            if (count <= 3) {
                context.write(k, value);
            } else {
                Count.count += 1;
            }
        } else {
            Count.header = value.toString();
        }
    }
}
